package prototipo.server.logic.transaction;

import java.util.GregorianCalendar;

import prototipo.server.logic.exception.ExceptionLogic;
import prototipo.server.logic.util.Money;

public class PaymentC extends Payment implements PaymentCIF{

	private String bank;
	private long number;
	private String sender;
	private GregorianCalendar dateDue;

	public PaymentC(Money value, String sender, String bank,
			GregorianCalendar dateDue) throws ExceptionLogic {
		super(value, false);
		this.setSender(sender);
		this.setBank(bank);
		this.setDateDue(dateDue);
	}

	/**
	 * @return the bank
	 */
	public String getBank() {
		return bank;
	}

	/**
	 * @param bank
	 *            the bank to set
	 * @throws ExceptionLogic
	 */
	public void setBank(String bank) throws ExceptionLogic {
		if (bank == null || bank.equals(""))
			throw new ExceptionLogic("Nome do banco vazio.", new Throwable(
					"String bank is null."));
		this.bank = bank;
	}

	/**
	 * @return the number
	 */
	public long getNumber() {
		return number;
	}

	/**
	 * @param number
	 *            the number to set
	 * @throws ExceptionLogic
	 */
	public void setNumber(long number) throws ExceptionLogic {
		if (number < 0)
			throw new ExceptionLogic("Numero de cheque negativo.",
					new Throwable("Number is negative."));
		this.number = number;
	}

	/**
	 * @return the sender
	 */
	public String getSender() {
		return sender;
	}

	/**
	 * @param sender
	 *            the sender to set
	 * @throws ExceptionLogic
	 */
	public void setSender(String sender) throws ExceptionLogic {
		if (sender == null || sender.equals(""))
			throw new ExceptionLogic("Emissor vazio.", new Throwable(
					"String sender is null."));
		this.sender = sender;
	}

	/**
	 * @return the dateDue
	 */
	public GregorianCalendar getDateDue() {
		return dateDue;
	}

	/**
	 * @param dateDue
	 *            the dateDue to set
	 * @throws ExceptionLogic
	 */
	public void setDateDue(GregorianCalendar dateDue) throws ExceptionLogic {
		if (dateDue == null)
			throw new ExceptionLogic("Data de vencimento vazia.",
					new Throwable("Calender is null."));
		this.dateDue = dateDue;
	}
}
